import { defineStore } from "pinia";
import { categoryGet } from "../api/pro";
import { CategoryType } from "../types/pro";
//使用interface约束state的返回值格式
interface CategoryStateType {
  list: CategoryType[];
}
export const useCategory = defineStore("category", {
  state: (): CategoryStateType => ({
    list: [],
  }),
  actions: {
    async categoryAct() {
      let res = await categoryGet();
      this.list = res.data.results;
    },
  },
});
